%% plot FFRLS inertia identification

% Forgetting factor
figure(1)
set(gcf, 'color', 'white'),     %set background of current plot figure to white
subplot(3,1,1)
plot(Jref_stepJ, 'k--'), hold on,
plot(J_stepJ, 'r'),
grid on,
axis([0 1.2 0 8*85e-7]),
xlabel('t(s)'),
ylabel('J(kg.m^2)'),

subplot(3,1,2)
plot(errJ_stepJ, 'r'),
grid on,
axis([0 1.2 -12 12]),
xlabel('t(s)'),
ylabel('error(%)'),
% p1 = find(abs(errJ_stepTL.Time-0.13)<50e-6)
% text(errJ_stepTL.Time(p1),errJ_stepTL.data(p1)+2.5, 'o', 'color', 'b');
% text(errJ_stepTL.Time(p1)-0.04,errJ_stepTL.data(p1)+18,['(',num2str(errJ_stepTL.Time(p1)),', ',num2str(errJ_stepTL.data(p1)),')']);
% p2 = find(abs(errJ_stepTL.Time-0.28)<50e-6)
% text(errJ_stepTL.Time(p2),errJ_stepTL.data(p2)+2, 'o', 'color', 'b');
% text(errJ_stepTL.Time(p2)-0.04,errJ_stepTL.data(p2)+18,['(',num2str(errJ_stepTL.Time(p2)),', ',num2str(errJ_stepTL.data(p2)),')']);
% p3 = find(abs(errJ_stepTL.Time-0.2)<50e-6)
% text(errJ_stepTL.Time(p3)-0.005,errJ_stepTL.data(p3)+4, 'o', 'color', 'b');
% text(errJ_stepTL.Time(p3)+0.005,errJ_stepTL.data(p3)+5,['(',num2str(errJ_stepTL.Time(p3)),', ',num2str(errJ_stepTL.data(p3)),')']);

subplot(3,1,3)
plot(wmref_stepJ, 'k--'), hold on,
plot(wm_stepJ, 'r'),
grid on,
axis([0 0.5 -inf inf]),
xlabel('t(s)'),
ylabel('Speed(rpm)'),
